/*    */ package com.ui;
/*    */ 
/*    */ import com.engine.Client;
/*    */ import com.engine.IConnect;
/*    */ import com.engine.IRecv;
/*    */ import com.engine.ReadConfig;
/*    */ import java.io.FileNotFoundException;
/*    */ import java.io.IOException;
/*    */ import org.apache.log4j.Category;
/*    */ 
/*    */ public class TicketProps
/*    */   implements Runnable, IRecv
/*    */ {
/* 14 */   static final Category log = Category.getInstance(TicketProps.class);
/*    */   private Client lcd;
/*    */   private String hostname;
/*    */   private int port;
/*    */   public static IRecv TICKET;
/* 19 */   private boolean isAlreadySentService = false;
/*    */ 
/*    */   public TicketProps() throws FileNotFoundException, IOException {
/* 22 */     this.lcd = new Client();
/* 23 */     ReadConfig.getInstance(null);
/* 24 */     this.hostname = ReadConfig.GET("TICKET_IP_CONFIG");
/* 25 */     this.port = Integer.parseInt(ReadConfig.GET("TICKET_PORT"));
/* 26 */     new Thread(this).start();
/* 27 */     TICKET = this;
/*    */   }
/*    */ 
/*    */   public void run()
/*    */   {
/* 32 */     while (!this.lcd.isConnected())
/*    */     {
/*    */       try {
/* 35 */         log.info("connect to: " + this.hostname + ":" + this.port);
/* 36 */         this.lcd.connect(this.hostname, this.port);
/* 37 */         if (this.lcd.isConnected())
/*    */         {
/* 39 */           SQUI.App1.connect(1);
/*    */         }
/*    */         else
/*    */         {
/* 43 */           SQUI.App1.disconnect(1);
/*    */         }
/*    */ 
/* 46 */         if ((this.lcd.isConnected()) && (!this.isAlreadySentService))
/*    */         {
/* 49 */           String service = ReadConfig.GET("SERVICE");
/* 50 */           String[] arrService = service.split("\\|");
/* 51 */           for (int i = 0; i < arrService.length; i++)
/*    */           {
/* 53 */             this.lcd.sendMessage("A|" + arrService[i]);
/*    */           }
/* 55 */           if (!this.isAlreadySentService)
/* 56 */             this.isAlreadySentService = true;
/*    */         }
/*    */       }
/*    */       catch (IOException e) {
/* 60 */         SQUI.App1.disconnect(1);
/*    */       }
/*    */       try {
/* 63 */         Thread.sleep(5000L);
/*    */       }
/*    */       catch (InterruptedException localInterruptedException)
/*    */       {
/*    */       }
/*    */     }
/* 69 */     SQUI.App1.disconnect(1);
/* 70 */     this.lcd.disconnect();
/* 71 */     new Thread(this).start();
/*    */   }
/*    */ 
/*    */   public void recv(String data)
/*    */   {
/*    */     try {
/* 77 */       if (this.lcd != null)
/* 78 */         this.lcd.sendMessage(data);
/*    */     }
/*    */     catch (IOException e) {
/* 81 */       log.info(e.getLocalizedMessage());
/*    */     }
/*    */   }
/*    */ 
/*    */   public void counter(int idx, String value)
/*    */   {
/*    */   }
/*    */ 
/*    */   public void displayTickerCounter(int idx)
/*    */   {
/*    */   }
/*    */ 
/*    */   public void writeLog(String msg)
/*    */   {
/*    */   }
/*    */ 
/*    */   public void writeLogRecv(String msg)
/*    */   {
/*    */   }
/*    */ 
/*    */   public void writeLogLCD(String msg)
/*    */   {
/*    */   }
/*    */ }

/* Location:           F:\16 2\SQ.jar
 * Qualified Name:     com.ui.TicketProps
 * JD-Core Version:    0.6.0
 */